package service

import (
	"context"
	"encoding/json"
	"gitee.com/ljfirst/algo-go-protal/integration/pb"
	algoGoSDKSort "gitee.com/ljfirst/algo-go-sdk/src/data_structure/sort/innerSort"
)

/**
 * @author 蔚蔚樱
 * @version V1.0
 * @date 2023/5/24 02:23
 * @author-Email micromicrohard@outlook.com
 * @blogURL https://blog.csdn.net/Micro_Micro_Hard
 * @description
 * */
type DispatchAlgorithm struct {
}

func (d *DispatchAlgorithm) Dispatch(ctx context.Context, req *pb.DispatchAlgorithmRequest, rsp *pb.DispatchAlgorithmResponse) {
	rsp.ClassName = req.EffectClassName
	heapSort := &algoGoSDKSort.BubbleSort{}
	arr := []int{1, 2, 3, 9, 6, 5, 4, 3}
	heapSort.SortMethod(arr)
	arrStr, _ := json.Marshal(arr)
	rsp.Result = map[string]string{
		"aaa": string(arrStr),
	}
	return
}
